<template>
  <div>
    <el-button type="primary" size="small" @click="query">查询</el-button>
    <el-table
      :data="list"
      stripe
      style="width: 100%">
      <el-table-column
        prop="date"
        label="日期"
        width="180">
      </el-table-column>
      <el-table-column
        prop="name"
        label="姓名"
        width="180">
      </el-table-column>
      <el-table-column
        prop="address"
        label="地址">
      </el-table-column>
      <el-table-column
        prop="test"
        label="测试">
      </el-table-column>
    </el-table>
    <el-pagination
      :current-page="params.page"
      :page-size="params.size"
      style="float: right;"
      layout="prev, pager, next"
      @current-change="changePage"
      :total="total">
    </el-pagination>
  </div>
</template>

<script>
  import * as cmsApi from '../api/cms'
  export default {
    data() {
      return {
        list: [],
        total: 0,
        params: {
          page: 1,
          size: 10
        }
      }
    },
    methods: {
      query: function (val) {
        let people = {
          name: '高浩东',
          age: 23,
          phone: '1213141'
        }
        //调用服务端接口
        cmsApi.people_list(people).then((res) => {
          console.log(res)
        });
      },
      changePage: function (page) {
        //调用query方法

      }
    },
    mounted() {
      //钩子函数
      this.query()
    }
  }
</script>

<style>

</style>
